package Lee_code;

public class Lee_518_dp
{
    public int change(int amount, int[] coins)
    {
        int[] dp = new int[amount+1];
        dp[0] = 1;
        for (int i = 0; i < coins.length; i++) { // 遍历物品
            for (int j = coins[i]; j <= amount; j++) { // 遍历背包容量
                dp[j] += dp[j - coins[i]];
            }
        }
        return dp[amount+1];
    }
}
